<!--suppress ALL -->
<include file="./Template/header.html" />
<link rel="stylesheet" type="text/css" href="/Template/css/faq.css?v=20200810">
<script type="text/javascript">

    $(function() {

        //初始化页面配置
        initPage("相关帮助");

        var app = new Vue({
            el: '#container',
            data: {
                faqList: [],
            },
            methods: {
                order: function(id) {
                    window.location.href = "/wechat/finishedProduct/finishedOrder/id/"+id;
                },
                orderList: function() {
                    window.location.href = "/wechat/finishedProduct/orderList";
                },
                detail: function(id) {
                    window.location.href = "/wechat/clubfoot/faqDetail/id/"+id;
                },
            }
        })
        function faqList(classId, keyword, type) {

            $.ajax({
                url:"/wechat/clubfoot/FaqList",
                type:"post",
                data:{
                    classId: classId,
                    keyword: keyword,
                    type: type
                },
                dataType:"JSON",
                beforeSend:function(){
                    $("#loadingToast").show();
                },
                complete:function(){
                    $('#loadingToast').hide();
                },
                success:function(data){
                    app.faqList = data;
                    setTimeout(function() {
//                        $(".ui-item.measure-info img").bind("click", function() {
//                            var upUrl = "/Template/images/icon-up.png";
//                            var downUrl = "/Template/images/icon-down.png";
//                            $(this).parent().next().toggle();
//                            if($(this).attr("src") == upUrl) {
//                                $(this).attr("src", downUrl);
//                            } else {
//                                $(this).attr("src", upUrl);
//                            }
//                        });
//                        $(".ui-item.measure-info img").each(function() {
//                            $(this).trigger("click");
//                        });
                    },200);
                },
            })
        }
        $(".search-box").change(function() {
            var value = $(this).find("option:selected").text();
            $(this).prev().attr('placeholder',value);
        });

        $(".have-padding").click(function() {


        });

        $("select[name=classId]").change(function() {

            var classId = $(this).val();
            var keyword = $("input[name=keyword]").val();
            faqList(classId,keyword,"{$type}");

        });

        $("input[name=keyword]").change(function() {
            var classId = $("select[name=classId]").val();
            var keyword = $(this).val();
            faqList(classId, keyword,"{$type}");

        });

        $("img[name=searchImg]").click(function() {

            var classId = $("select[name=classId]").val();
            var keyword = $("input[name=keyword]").val();
            faqList(classId, keyword,"{$type}");

        });

        faqList("{$classId}","{$keyword}","{$type}");

        var value = $("select[name=classId]").find("option:selected").text();
        $("select[name=classId]").prev().attr('placeholder',value);
    });


</script>
<div class="container" id="container">
    <div class = "search">
        <div class="class-search">
            <span class="class-select">分类：</span>
            <img class="icon-arrow" src="/Template/images/icon-arrow.png" alt="">
            <input class="search-line" type="text" placeholder="请选择分类" readonly>
            <select class="search-box" name="classId">
                <option value="0" class="choose">全部</option>
                {:getFaqClassSelectOptionHtml($classId, 0)}
            </select>
        </div>
        <div class="keyword-search">
            <span class="keyword-input">关键字：</span>
            <img name="searchImg" class="icon-keyword" src="/Template/images/icon-search.png" alt="">
            <input name="keyword" class="keyword-line" type="text" placeholder="请输入关键字">
        </div>
    </div>
    <div class="finishedProduct-detail">
        <div class="finishedProduct-info" v-for="list in faqList">
            <div class="have-padding" v-on:click="detail(list.faq_id)">
                <div class="product-info">

                    <div class="detail-info">
                        <!--<div v-if="list.faq_class_id == 1">-->

                        <!--</div>-->
                        <div>
                            <span class="item-class">[{{list.faq_class_name}}]</span>

                            <p class="product-name">{{list.name}}</p>
                            <div v-if="list.faq_class_type == 1">
                                <img class="finishedProduct-img" src="{{list.image_url}}" alt="product">

                                    <span class="finishedProduct-img-right">{{list.question}}</span>

                            </div>

                            <div v-if="list.faq_class_type != 1">
                                <div class="ui-item ">
                                    <span class="item-left">问题:</span>
                                    <span class="item-right">{{list.question}}</span>
                                </div>
                                <div class="ui-item " >
                                    <span class="item-left">解答:</span>
                                    <span class="item-right">{{list.answer}}</span>
                                </div>
                            </div>
                        </div>
                        <!--<p class="product-price"><span style="color: #d92f3b;">￥{{list.price}}</span> / {{list.unit}}</p>-->

                        <!--<p class="product-class">{{list.class_name}}</p>-->
                        <!--<p class="product-supplier">[{{list.supplier}}]</p>-->
                        <!--<p class="product-size">规格：{{list.size}} </p>-->
                    </div>
                    <!--p class="sum">共{{order.number}}件商品 合计:<span style="color: #d92f3b;">￥{{order.price}}</span></p-->
                </div>
                <div class="finishedProduct-detail-info" >
                    <div class="ui-item measure-info">
                        <span class="item-count">阅读量：{{list.count}}</span>
                        <span class="item-detailname">点击查看详情</span>
                        <img class="icon-up" src="/Template/images/icon-down.png" alt="">
                    </div>
                </div>
            </div>
            <div class="line"></div>
        </div>

    </div>

</div>

<include file="./Template/footer.html" />

